package com.block.common.security.service.sign;


import com.alibaba.fastjson.JSONObject;
import com.block.common.security.service.AppSignMannerService;
import com.block.common.util.RSACoderUtil;
import com.block.db.entity.AppEncrypt;

import java.util.Map;

public class XHYSignEncryptService extends AppSignMannerService {

    @Override
    public String sign(AppEncrypt appEncrypt, String tranData, String randomKey) {
        return null;
    }

    @Override
    public boolean validateSign(AppEncrypt appEncrypt, String reqSignStr, Map<String, Object> reqMap, String ciphertext, JSONObject tranData) {
        reqSignStr=tranData.getString("sign");
        Map<String,Object> paramsMap = reqMap;
        paramsMap.remove("sign");

        return RSACoderUtil.verify(paramsMap, appEncrypt.getPublicKey(), reqSignStr);
    }
}
